package com.wxq.order.feign;

import com.wxq.common.to.SkuHasStockTO;
import com.wxq.common.utils.R;
import com.wxq.order.vo.WareSkuLockVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 库存服务远程接口 {@link WareFeignService}
 *
 * @author Kevin
 * @email: 178676392@qq.com
 */
@FeignClient("yomall-ware")
public interface WareFeignService {

    /**
     * 查询sku是否有库存
     * @param skuIds
     * @return
     */
    @PostMapping("/ware/waresku/hasstock")
    List<SkuHasStockTO> getSkuHasStock(@RequestBody List<Long> skuIds);

    /**
     * 获取物流运费
     * @param addrId
     * @return
     */
    @GetMapping("/ware/fare")
    R getFare(@RequestParam("addrId") Long addrId);

    /**
     * 锁定订单库存
     * @param vo
     * @return
     */
    @PostMapping("/ware/waresku/lock/order")
    R orderLockStock(@RequestBody WareSkuLockVO vo);
}
